/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.aqlm.data;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.rainbow.annotation.xml.NodeText;
import org.rainbow.annotation.xml.ParentAttr;

/**
 *
 * @author hironaga
 */
public class MenuUDO {

    private static DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd");

    @ParentAttr( attrName="id" )
    private String id;

    @NodeText( elementName="name" )
    private String name;

    @NodeText( elementName="subname" )
    private String subname;

    @NodeText( elementName="minutes" )
    private int minutes;

    @NodeText( elementName="price" )
    private int price;

    @NodeText( elementName="active-date-from" )
    private Date activeDateFrom;

    @NodeText( elementName="active-date-to" )
    private Date activeDateTo;

    @Override
    public String toString(){
        return //super.toString() +
                "id:" + this.id +
                ", name:" + this.name +
                ", subname:" + this.subname +
                ", minutes:" + this.minutes + 
                ", price:" + this.price +
                ", activeDateFrom:" + this.getActiveDateFrom() +
                ", activeDateTo:" + this.getActiveDateTo(); 
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSubname() {
        return subname;
    }

    public void setSubname(String subname) {
        this.subname = subname;
    }

    public int getMinutes() {
        return minutes;
    }

    public void setMinutes(int minutes) {
        this.minutes = minutes;
    }

    public int getPrice() {
        return price;
    }

    public void setPrice(int price) {
        this.price = price;
    }

    public Date getActiveDateFrom() {
        return activeDateFrom;
    }

    public void setActiveDateFromString(String activeDateFrom) {
        try {
            this.activeDateFrom = dateFormat.parse(activeDateFrom);
        } catch (ParseException ex) {
            throw new IllegalArgumentException(ex);
        }
    }

    public Date getActiveDateTo() {
        return activeDateTo;
    }

    public void setActiveDateToString(String activeDateTo) {
        try {
            this.activeDateTo = dateFormat.parse(activeDateTo);
        } catch (ParseException ex) {
            throw new IllegalArgumentException(ex);
        }
    }

    public void setActiveDateFrom(Date activeDateFrom) {
        this.activeDateFrom = activeDateFrom;
    }

    public void setActiveDateTo(Date activeDateTo) {
        this.activeDateTo = activeDateTo;
    }
    
}
